home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000114-20000217 / 000279_news@columbia.edu _Wed Feb 16 15:10:29 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  3KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id PAA03291
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Wed, 16 Feb 2000 15:10:29 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id MAA01157
  7.     for kermit.misc@watsun.cc.columbia.edu; Tue, 15 Feb 2000 12:36:50 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Subject: Re: pb with script programming,
  11. Date: 15 Feb 2000 17:36:46 GMT
  12. Organization: Columbia University
  13. Message-ID: <88c2re$142$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@columbia.edu
  15.  
  16. In article <88c1mo$o8c$1@wanadoo.fr>, AMT <amt.mhn@netcourrier.com> wrote:
  17. : i wirk on an hp/ux 10.0 workstation
  18. And C-Kermit?  Which version?  The current version is 7.0:
  19.  
  20.   http://www.columbia.edu/kermit/ckermit.html
  21.  
  22. : I want to make the same commands to differents nodes of my network
  23. : i have coded the script
  24. : ..
  25. : cat /etc/hosts | while read LIGNE
  26. : do
  27. :      EQUIP= echo $LIGNE | awk '{print $2}'`
  28. :     CMDE="set host $EQUIP, take /filexx"
  29. :     kermit -c "$CMDE";
  30. :     echo "AAAAA"
  31. : done
  32. : echo "BBBBB""
  33. : exit
  34. I think in "kermit -c" you need an uppercase 'C'.
  35.  
  36. However, this is not the best way to execute a C-Kermit script in Unix.
  37. Please visit:
  38.  
  39.   http://www.columbia.edu/kermit/ckscripts.html
  40.  
  41. to find out how to construct and invoke your C-Kermit scripts exactly as
  42. if they were shell scripts.
  43.  
  44. : the filexx have
  45. : def unix do vax, set term byte 7
  46. : set input timeout-action proceed
  47. : .....
  48. : set exit warning off
  49. : input 1 ok
  50. : if success go to suit
  51. : end
  52. : :suit
  53. : ...
  54. : ...
  55. : end
  56. : when all the nodes are up it's ok, but when the node "n" is down i have the
  57. : message : unable to connect to "n"
  58. : connection time-out. i go back to my script and it execute echo AAAAA echo
  59. : BBBBB and it ends. so i havent made my commands to the nodes n+1 n+2 .....
  60. : who can help me ?
  61. Where is the list of nodes coming from?
  62.  
  63. Personally, I would recode the script as a Kermit script (no shell
  64. scripting), put the list of nodes in an array, and loop through the array.
  65. Example:
  66.  
  67.   #!/usr/local/bin/kermit +
  68.   declare \&n[] = node1 node2 node3 node4 ...
  69.   for \%i 1 \fdim(&n) 1 {
  70.       set host \&n[\%i]
  71.       if fail {
  72.           (commands to execute if node can't be reached)
  73.       } else {
  74.           (commands to execute if connection to node was successful)
  75.       }
  76.   }
  77.   exit 0
  78.  
  79. Of course you can also have the script read the list of nodes from a file,
  80. or get it from an environment variable, receive them as command-line arguments,
  81. or any other way you like.  Here is how to do it with command-line arguments:
  82.  
  83.   #!/usr/local/bin/kermit +
  84.   for \%i 1 \v(argc) 1 {
  85.       set host \&_[\%i]  ; This is the array of command-line arguments
  86.       if fail {
  87.           (commands to execute if node can't be reached)
  88.       } else {
  89.           (commands to execute if connection to node was successful)
  90.       }
  91.   }
  92.   exit 0
  93.  
  94. For details, see the script programming chapters of "Using C-Kermit":
  95.  
  96.   http://www.columbia.edu/kermit/ck60manual.html
  97.  
  98. and the C-Kermit 7.0 update notes:
  99.  
  100.   http://www.columbia.edu/kermit/ckermit2.html
  101.  
  102. - Frank